package com.tianzeculture.stagebao.activity.artist.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.tianzeculture.stagebao.activity.artist.fragment.ArtistDataFragment;
import com.tianzeculture.stagebao.activity.artist.fragment.ArtistPhotoFragment;
import com.tianzeculture.stagebao.activity.artist.fragment.ArtistVideoFragment;

/**
 * Created by Administrator on 2018/6/7 0007.
 */

public class ArtistAdaoter extends FragmentPagerAdapter {
    String[] titles;
    public ArtistAdaoter(FragmentManager fm,String[] titles) {
        super(fm);
        this.titles =titles;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        switch (position){
            case 0:
                fragment = new ArtistDataFragment();
                break;
            case 1:
                fragment = new ArtistPhotoFragment();
                break;
            case 2:
                fragment = new ArtistVideoFragment();
                break;
        }

        return fragment;
    }

    @Override
    public int getCount() {
        return titles.length;
    }
}
